//
//  PBOnlineInputCell.m
//  PBHomeDemo
//
//  Created by Playboy on 2017/12/24.
//  Copyright © 2017年 tmkj. All rights reserved.
//

#import "PBOnlineInputCell.h"

@interface PBOnlineInputCell ()
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UITextField *nameTextField;
@property (nonatomic, strong) NSArray *typeArray;
@property (nonatomic, strong) NSArray *desArray;
@end

@implementation PBOnlineInputCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.typeArray = @[@"真实姓名",@"手机号",@"所在城市",@"小区名称"];
    self.desArray = @[@"请填写真实姓名",@"请输入手机号",@"请输入城市",@"请输入小区名称"];
    [self.nameTextField addTarget:self action:@selector(nameTextFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)refreshWithIndexPath:(NSIndexPath *)indexPath {
    self.nameLabel.text = self.typeArray[indexPath.row];
    self.nameTextField.placeholder = self.desArray[indexPath.row];
    self.nameTextField.tag = indexPath.row;
}


- (void)nameTextFieldDidChange:(UITextField *)textField {
    if (self.delegate && [self.delegate respondsToSelector:@selector(getInfoWithtag:text:)]) {
        [self.delegate getInfoWithtag:[NSString stringWithFormat:@"%zd",textField.tag] text:textField.text];
    }
}

@end
